<template>
	<view class="user u-skeleton" :class="themeName">
		<view class="user-info flex-col">
			<!-- #ifndef  H5 -->
			<u-sticky offset-top="0" h5-nav-height="0" bg-color="transparent">
				<u-navbar title="云仓配送" :title-bold="true" :is-fixed="false" :border-bottom="false"
					:background="{ background: 'rgba(256,256, 256,' + percent + ')' }"
					:back-icon-color="percent > 0.5 ? '#000' : '#fff'" :title-color="percent > 0.5 ? '#000' : '#fff'">
				</u-navbar>
			</u-sticky>
			<!-- #endif -->
			<u-gap height="40"></u-gap>
			<view class="user-top flex flex-1">
				<view class="logo flex row-center col--center">
					<image class="avatar" :src="userInfo.avatar" mode="widthFix" />
				</view>
				<view class="m-l-30 flex-1">
					<view class="xxl white bold">{{clwhInfo.title}}</view>
					<view class="user-id m-t-10">
						<view class="xs m-r-20 white">{{$zhTran('负责人')}}：{{userInfo.nickname}}</view>
						<view class="xs m-t-10 white">{{$zhTran('联系电话')}}：{{userInfo.mobile}}</view>
					</view>
				</view>
			</view>
			<u-gap height="80"></u-gap>
		</view>
		<view class="body p-20" :style="{
			top: '-70rpx'
		}">

			<view class="top-tab item-tab">
				<view class="title flex row-left">
					<view>
						<u-line direction="col" length="30rpx" color="rgba(64, 115, 250, 1)" :hair-line="false"
							border-width="6rpx" margin="0rpx 10rpx"></u-line>
					</view>
					<text>{{$zhTran('配送')}}</text>
				</view>
				<view class="data-tab flex row-between">
					<view>
						<view class="number">{{clwhInfo.wait_send||0}}</view>
						<view class="desc">{{$zhTran('待配送')}}</view>
					</view>
					<view>
						<view class="number">{{clwhInfo.wait_receive||0}}</view>
						<view class="desc">{{$zhTran('配送中')}}</view>
					</view>
					<view>
						<view class="number">{{clwhInfo.finish||0}}</view>
						<view class="desc">{{$zhTran('已签收')}}</view>
					</view>
				</view>
			</view>

			<view class="top-tab item-tab">
				<view class="title flex row-left">
					<view>
						<u-line direction="col" length="30rpx" color="rgba(64, 115, 250, 1)" :hair-line="false"
							border-width="6rpx" margin="0rpx 10rpx"></u-line>
					</view>
					<text>{{$zhTran('收益')}}</text>
				</view>
				<view class="data-tab flex row-around">
					<view>
						<view class="number">{{clwhInfo.wait_confirm||0}}</view>
						<view class="desc">{{$zhTran('待确认收益')}}</view>
					</view>
					<view>
						<view class="number">{{clwhInfo.been_confirm||0}}</view>
						<view class="desc">{{$zhTran('已确认收益')}}</view>
					</view>
				</view>
			</view>

			<view class="item-tab">
				<view class="data-body">

					<view class="flex row-between m-b-20">
						<view class="data-card text-center" @click="toPath('order/order')">
							<image class="icon" :src="$getImageUri('resource/image/shopapi/default/icon-01.png')"
								mode="widthFix" />
							<view class="title m-t-10">{{$zhTran('配送订单')}}</view>
							<view class="desc">{{$zhTran('查看配送订单')}}</view>
						</view>
						<view class="data-card text-center" @click="toPath('settlement')">
							<image class="icon" :src="$getImageUri('resource/image/shopapi/default/icon-02.png')"
								mode="widthFix" />
							<view class="title m-t-10">{{$zhTran('配送收益')}}</view>
							<view class="desc">{{$zhTran('查看配送收益')}}</view>
						</view>
					</view>

				</view>
			</view>

		</view>
		<loading-view v-show="loading"></loading-view>

	</view>
</template>

<script>
	import {
		apiCloudWarehouseInfo,
	} from "@/api/cloud_warehouse"
	export default {
		data() {
			return {
				clwhInfo: {},
				percent: 0,
				loading: true,
			}
		},
		methods: {
			getCloudWarehouseInfo() {
				apiCloudWarehouseInfo().then(res => {
					this.clwhInfo = this.$zhTran(res);
					if (res.status) {
						this.loading = false
					} else {
						this.$Router.replace('/bundle3/pages/cloud_warehouse/freeze')
					}
				})
			},
			onPageScroll(e) {
				const top = uni.upx2px(100)
				const {
					scrollTop
				} = e
				this.percent = scrollTop / top > 1 ? 1 : scrollTop / top
			},
			toPath(url) {
				this.$Router.push({
					path: '/bundle3/pages/cloud_warehouse/' + url
				})
			}
		},
		computed: {},
		onLoad() {
			this.getCloudWarehouseInfo()
		},
	}
</script>

<style lang="scss" scoped>
	.user-info {
		background-color: rgba(64, 115, 250, 1);
		background-size: 100% auto;
		background-repeat: no-repeat;
		box-sizing: border-box;

		&.u-skeleton-rect {
			height: 518rpx;
		}

		.user-top {
			padding: 0 30rpx;
			// #ifdef  H5
			padding-top: 30rpx;

			// #endif
			.logo {
				width: 110rpx;
				height: 110rpx;
				border-radius: 50%;
				background-color: #fff;

				image {
					width: 60rpx;
				}
			}
		}
	}

	.body {
		position: relative;

		.top-tab {
			width: 100%;
			padding: 30rpx;
			background-color: #fff;
			border-radius: 20rpx;
		}


		.item-tab {
			margin-bottom: 20rpx;

			.title {
				color: rgba(47, 47, 47, 1);
				font-size: 28rpx;
				font-weight: bold;
				margin-bottom: 20rpx;
			}

			.data-tab {
				padding: 0 30rpx;
				background-color: #fff;
				border-radius: 20rpx;
				text-align: center;

				.number {
					color: rgba(58, 58, 58, 1);
					font-size: 38rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
				}

				.desc {
					color: rgba(128, 128, 128, 1);
					font-size: 26rpx;
				}
			}

			.data-body {

				.data-card {
					padding: 30rpx;
					border-radius: 20rpx;
					background-color: #fff;
					width: 48%;

					&.u-skeleton-rect {
						height: 160rpx;
					}

					.icon {
						width: 80rpx;
					}

					.title {
						color: rgba(58, 58, 58, 1);
						font-size: 30rpx;
						font-weight: bold;
						margin-bottom: 10rpx;
					}

					.desc {
						color: rgba(128, 128, 128, 1);
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>